<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统管理</el-breadcrumb-item>
      <el-breadcrumb-item>参数设置</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card>
        <el-row :gutter="20">


            <el-col :span="13">
            <el-label>平顺度（单位：每平方秒m2/s）</el-label>
 
        </el-col>


      </el-row>
      <el-row>
         <el-col :span="15">
                <el-label>平顺性指数，加权计算： =k1（a1*x1+a2*x2+a3*x3）+k2（a4*x4+a5*x5+a6*x6）</el-label>
            </el-col>
</el-row>
      <el-row>
           <el-col :span="1">
                <el-label>k1:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="k1"
            v-model="aa1"

          >
          </el-input>
          
        </el-col>
        <el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>

                    <el-col :span="1">
                <el-label>k2:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="k2"
            v-model="aa2"

          >
          </el-input>
        </el-col>
      </el-row>


            <el-row >
        
            <el-col :span="1">
                <el-label>a1:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="a1"
            v-model="a1"

          >
          </el-input>
        </el-col>
<el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>
                    <el-col :span="1">
                <el-label>a2:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="a2"
            v-model="a2"

          >
          </el-input>
        </el-col>
<el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>
                    <el-col :span="1">
                <el-label>a3:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="a3"
            v-model="a3"

          >
          </el-input>
        </el-col>

        </el-row>
        <el-row>

           <el-col :span="1">
                <el-label>a4:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="a4"
            v-model="a4"

          >
          </el-input>
        </el-col>
<el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>
           <el-col :span="1">
                <el-label>a5:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="a5"
            v-model="a5"

          >
          </el-input>
        </el-col>
        <el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>
<el-col :span="1">
                <el-label>a6:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="a6"
            v-model="a6"

          >
          </el-input>
        </el-col>

      </el-row>

  <el-divider></el-divider>


        <el-row type="flex" justify="end">
            <el-button type="primary" @click="updateparam()" icon="el-icon-edit"
                        >确定修改</el-button>
            </el-row>
    </el-card>

  </div>
</template>

<script>

export default {
  data () {
    return {

      nowcontact: {},

      paramList1: [],
      paramList2:[],
      a1:0,a2:0,a3:0,a4:0,a5:0,a6:0,
      aa1:0,aa2:0

    }
  },
  created () {
    // 加载页面时 加载一次数据
    this.getparamList1()

  },
  methods: {
  
  async getparamList1() {
      const { data: res } = await this.$http.get('param/getparam/A')
      if (res.code !== 200) return this.$message.error('Error:' + res.message)
      this.paramList1 = res.data
      this.a1 = this.paramList1[0].value
      this.a2 = this.paramList1[1].value
      this.a3 = this.paramList1[2].value
      this.a4 = this.paramList1[3].value
      this.a5 = this.paramList1[4].value
      this.a6 = this.paramList1[5].value
      this.aa1 = this.paramList1[9].value
      this.aa2 = this.paramList1[10].value

    },


    async updateparam () {
      const { data: res } = await this.$http.post(
        'param/updateparam',
        {

        'A1': this.a1, 
        'A2': this.a2, 
        'A3': this.a3, 
        'A4': this.a4, 
        'A5': this.a5, 
        'A6': this.a6, 
        'AA1': this.aa1, 
        'AA2': this.aa2, 


        }, {
          headers: {
            'content-type': 'application/json',
            'X-Request-With': 'XMLHttpRequest',
            'token': window.sessionStorage.getItem('token')
          }
        }
      )
      if (res.code !== 200) return this.$message.error('Error:' + res.message)
      this.getparamList()
    },



  },
  filters: {

  }
}
</script>

<style lang="less" scope>
.el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0px;
      align:'center'
    }
  }

.el-label{
  align:'center'
}
</style>
